package com.example.curd.mapper;

import com.example.curd.entity.Role;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author dakai
 * @since 2021-04-18
 */
public interface RoleMapper extends BaseMapper<Role> {

  @Select("select * from role")
  List<Role> SelectAll();

  @Select("select * from role where id=#{id}")
  List<Role> SelectOne(Integer id);

  @Delete("delete from role where id=#{id}")
  int DeleteOne(Integer id);

  @Insert("insert into role(id,name)values(#{id},#{name})")
  int InsertOne(Role role);

  @Update("update role set name = #{name} where id= #{id}")
  int UpdateOne(Role role);

}
